package pl.squeaky.mvc.wizard;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class NewModelNamePage extends WizardPage {

	private Text txtName;
	private Text txtSuperclass;

	protected NewModelNamePage() {
		super("NewModelNamePage");
		
		setTitle("New model");
		setDescription("Choose model name and superclass");
	}

	@Override
	public void createControl(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(3, false));
		setControl(composite);
		
		Label lblName = new Label(composite, SWT.NONE);
		lblName.setText("Name:");
		
		txtName = new Text(composite, SWT.BORDER);
		GridData txtNameData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
		txtNameData.horizontalSpan = 2;
		txtName.setLayoutData(txtNameData);
		
		Label lblSuperclass = new Label(composite, SWT.NONE);
		lblSuperclass.setText("Superclass:");
		
		txtSuperclass = new Text(composite, SWT.BORDER);
		txtSuperclass.setText("Zend_Db_Table_Abstract");
		txtSuperclass.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
		
		Button btnBrowse = new Button(composite, SWT.PUSH);
		btnBrowse.setText("Browse...");
		btnBrowse.setLayoutData(new GridData(90, SWT.DEFAULT));
		
	}
	
	public String getModelName() {
		return txtName.getText();
	}
	
	public String getSuperclassName() {
		return txtSuperclass.getText();
	}

}
